<template>
  <div class="support-box">
    <div>
      <el-descriptions title="（3）参与和计划成渝地区双城经济圈建设情况" :column="4" border>
        <el-descriptions-item :label="`${examineYear}年度是否参与成渝地区双城经济圈建设/是否计划${examineYear - (-1)}年度参与相关活动`">
          <el-switch inline-prompt v-model="radio1" disabled active-text="是" inactive-text="否"> </el-switch>
        </el-descriptions-item>
      </el-descriptions>

      <div class="list-con-box">
        <div class="single-list" v-for="item in detailInfo">
          <el-radio-group v-model="item.supportYear" disabled>
            <el-radio :label="examineYear" disabled>{{ `${lastYear}年开展` }}</el-radio>
            <el-radio :label="examineYear - (-1)">{{ `${currentYear}年计划开展` }}</el-radio>
          </el-radio-group>
          <p>项目名称：{{ item.nextProjectName }}</p>
          <p>项目支出：人民币 {{ item.nextProjectName }}元</p>
          <p>受益建档立卡贫困户：{{ item.thenBenefitNum }}户，{{ item.thenBenefitUserNum }}人</p>
          <p>项目受益地点：{{ item.thenBenefitAddress }}</p>
          <div class="pro-type">
            项目类别：
            <el-checkbox-group v-model="item.thenProjectTypes" disabled>
              <el-checkbox :value="innerItem.id" :key="innerItem.id" v-for="innerItem in dictZYXZ"
                :label="innerItem.id">{{ innerItem.name }}</el-checkbox>
            </el-checkbox-group>
          </div>
          <p>项目内容：{{ item.thenProjectConcent }}</p>
        </div>
      </div>
    </div>
  </div>
</template>

<script setup lang="ts">
//获取
import { ref, reactive, inject } from 'vue'
import { getDictZJ } from '@/api/dict/index'
const radio1 = ref(true)

let currentYear = ref('')
let lastYear = ref('')
let dictZYXZ = ref([])
let examineYear = ref()


let detailInfo = ref([])
const { getDetailInfo } = inject('getDetailInfo')

getDetailInfo(15).then(res => {
  examineYear.value = res.examineYear
  detailInfo.value = res.data.map(item => {
    return { ...item, thenProjectTypes: JSON.parse(item.thenProjectTypes) }
  })
  radio1.value = res.data.length ? true : false
})

const getDict = () => {
  getDictZJ().then(res => {
    dictZYXZ.value = res.data
  })
}

const getYear = () => {
  currentYear = new Date().getFullYear();
  lastYear = currentYear - 1;
}
getYear()
getDict()

</script>
<style lang="scss" scoped>
.list-con-box {
  padding: 20px;

  .single-list {
    border: 1px solid #000;
    padding: 20px;
    margin-bottom: 10px;
  }
}
</style>
